package com.suneast.suneaststore.modules.personal.collect.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suneast.suneaststore.R;
import com.suneast.suneaststore.bean.personal.collect.CollectStoreBean;
import com.suneast.suneaststore.ui.customview.ZzCheckBox;

public class CollectStoreAdapter extends BaseQuickAdapter<CollectStoreBean, CollectStoreAdapter.VH> {

    private boolean showCheckBox;

    public void setShowCheckBox(boolean showCheckBox) {
        this.showCheckBox = showCheckBox;
    }

    public CollectStoreAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(VH helper, CollectStoreBean item) {
        ZzCheckBox checkBox = helper.getView(R.id.cb_select);
        checkBox.setVisibility(showCheckBox ? View.VISIBLE : View.GONE);
        Glide.with(helper.itemView.getContext()).load(item.getLogo())
                .into((ImageView) helper.getView(R.id.iv_store));
        helper.setText(R.id.tv_store_name, item.getMerchname())
                .addOnClickListener(R.id.btn_go_to_store);
    }

    public static class VH extends BaseViewHolder {
        public VH(View view) {
            super(view);
        }
    }
}
